﻿using System;

namespace XEvolve.Core.Runtime.Attributes
{
    [AttributeUsage(AttributeTargets.Parameter)]
    public class ExtensionAttribute : Attribute, IDependencyAttribute
    {
        private readonly object extensionPointIdentifier;
        private readonly object extensionIdentifier;


        public ExtensionAttribute(object extensionPointIdentifier, object extensionIdentifier)
        {
            this.extensionPointIdentifier = extensionPointIdentifier;
            this.extensionIdentifier = extensionIdentifier;
        }

        public object ProvideValue(IExtensionRegistry registry)
        {
            return registry.GetExtensionPoint(extensionPointIdentifier).GetExtension(extensionIdentifier);
        }
    }
}